<template>
    <div class="mainBox">
        vuex {{$store.state.count}}
        <button @click="increment">增加</button>
        <button @click="decrement">减少</button>
    </div>
</template>
<style rel="stylesheet/scss" lang="scss" scoped>
    
</style>
<script>
import { mapActions } from "vuex" 
export default {
    data() {
       return {
            
        }
    },
//	创建实例时就会触发
    created() {
        
    },
    mounted() {
        
    },
//	检测视图值变化触发，有改变就会触发
    computed:{
        
    },
    // 写法1
    methods:{
        ...mapActions([
            'increment',
            'decrement'
        ])
    },
    // 方法2
    // this.$store.dispatch("increment")
    components: {
        
    },
}
</script>
